-
-
Notifications
You must be signed in to change notification settings - Fork 648
Add a function to share decryption keys for room history #1629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the core of this looks good, but I wonder if it would be best to move the nextMessage bit here instead of leaving it at the React layer.
| ); | ||
| result = { | ||
| result: plaintext, | ||
| message_index: res.message_index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this instead match the style of other properties...?
| message_index: res.message_index, | |
| messageIndex: res.message_index, |
| } catch (e) { | ||
| continue; | ||
| } | ||
| const index = res.message_index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update here as well if naming is changed.
| * @param {object} devicesByUser a map of user to array of module:crypto/deviceinfo. | ||
| * @param {function} nextMessage a function that returns the next Matrix message to | ||
| * to share keys for each time it is called. The function should return a | ||
| * {module:models/event.MatrixEvent}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should more explicitly say it's a promise of an event.
| const encryptedContent = { | ||
| algorithm: olmlib.OLM_ALGORITHM, | ||
| sender_key: this._olmDevice.deviceCurve25519Key, | ||
| ciphertext: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be empty...? 🤔
| }; | ||
|
|
||
| const sessionBySenderKey = {}; | ||
| for (let message = await nextMessage(); message !== undefined; message = await nextMessage()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe test for just message? Other people might return null for example.
| * Share the keys with the given users for the given messages. | ||
| * | ||
| * @param {object} devicesByUser a map of user to array of module:crypto/deviceinfo. | ||
| * @param {function} nextMessage a function that returns the next Matrix message to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would a general user of the JS SDK (outside of Element) have any idea what this function should be...?
Either we need much more extensive documentation here, or we should more likely move this function into the JS SDK itself, since at least the draft version doesn't seem to have a UI component.
|
I assume this can be closed since we merged #1640 instead. |
Needed for matrix-org/matrix-react-sdk#5711